import 'package:flutter/material.dart';
import 'package:good_good_study/common/index.dart';
import 'package:good_good_study/pages/splash_page.dart';
import 'package:good_good_study/provider/app_provider.dart';
import 'package:good_good_study/provider/collect_provider.dart';
import 'package:good_good_study/provider/current_index_provider.dart';
import 'package:good_good_study/provider/home_provider.dart';
import 'package:overlay_support/overlay_support.dart';
import 'package:provider/provider.dart';

void main() {
  runApp(OverlaySupport(
    toastTheme: ToastThemeData.raw(
        textColor: Colors.white,
        background: ColorUtil.color("85000000"),
        alignment: Alignment.center),
    child: MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider<CurrentIndexProvider>(
          create: (_) => CurrentIndexProvider(),
        ),
        ChangeNotifierProvider<HomeProvider>(
          create: (_) => HomeProvider(),
        ),
        ChangeNotifierProvider<AppProvider>(
          create: (_) => AppProvider(),
        ),
        ChangeNotifierProvider<CollectProvider>(
          create: (_) => CollectProvider(),
        ),
      ],
      child: MaterialApp(
        home: SplashPage(),
      ),
    );
  }
}
